{% extends 'base.html' %}

{% block title %}注册 - AI故事生成系统{% endblock %}

{% block content %}
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">
                    <h3 class="card-title">用户注册</h3>
                </div>
                <div class="card-body">
                    <form method="post" novalidate>
                        {% csrf_token %}
                        <div class="mb-3">
                            <label for="{{ form.username.id_for_label }}" class="form-label">用户名</label>
                            <input type="text" name="username" id="{{ form.username.id_for_label }}" class="form-control {% if form.username.errors %}is-invalid{% endif %}" required>
                            {% if form.username.errors %}
                            <div class="invalid-feedback">
                                {{ form.username.errors|join:", " }}
                            </div>
                            {% endif %}
                        </div>

                        <div class="mb-3">
                            <label for="{{ form.password1.id_for_label }}" class="form-label">密码</label>
                            <input type="password" name="password1" id="{{ form.password1.id_for_label }}" class="form-control {% if form.password1.errors %}is-invalid{% endif %}" required>
                            {% if form.password1.errors %}
                            <div class="invalid-feedback">
                                {{ form.password1.errors|join:", " }}
                            </div>
                            {% else %}
                            <div class="form-text">
                                <ul>
                                    <li>密码不能太相似于你的个人信息</li>
                                    <li>密码必须至少包含8个字符</li>
                                    <li>密码不能是常用密码</li>
                                    <li>密码不能全是数字</li>
                                </ul>
                            </div>
                            {% endif %}
                        </div>

                        <div class="mb-3">
                            <label for="{{ form.password2.id_for_label }}" class="form-label">确认密码</label>
                            <input type="password" name="password2" id="{{ form.password2.id_for_label }}" class="form-control {% if form.password2.errors %}is-invalid{% endif %}" required>
                            {% if form.password2.errors %}
                            <div class="invalid-feedback">
                                {{ form.password2.errors|join:", " }}
                            </div>
                            {% endif %}
                        </div>

                        <div class="d-grid gap-2">
                            <button type="submit" class="btn btn-primary">注册</button>
                            <a href="{% url 'user:login' %}" class="btn btn-outline-secondary">已有账号？登录</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %} 